﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

// 单播
delegate int NumberChanger(int n);
namespace CS_BEGINNER_TO_PROFICIENT.STD.DelegatedSTD
{
    public class DelegatedSTDP1
    {
        static int num = 10;

        public static int AddNum(int p) => num += p;

        public static int MultNum(int q) => num *= q;

        public static int getNum() => num;

        public static void Execute()
        {
            NumberChanger nc1 = new NumberChanger(AddNum);
            NumberChanger nc2 = new NumberChanger(MultNum);

            nc1(25);
            Console.WriteLine("Value of Num: {0}", getNum());
            nc1(5);
            Console.WriteLine("Value of Num: {0}", getNum());
        }
    }
}
